<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>节点练习 - 复制节点</title>
  </head>

  <body>
    <div id="three" class="three">
      我是three内容
      <ul>
        <li>简简单单的早餐</li>
        <li>简简单单的午饭</li>
        <li>简简单单的晚饭</li>
      </ul>
      <button onclick="btn_copy_one()">复制第二个节点放到最后</button>
    </div>
    <script>
      let x = document.getElementById("three").getElementsByTagName("ul")[0];
      const btn_copy_one = () => {
        y = x.getElementsByTagName("li"); //选择复制对象
        z = y[1].cloneNode(true); //复制
        console.log(y, z);
        x.appendChild(z); //放入
      };
    </script>
  </body>
</html>
